package zozopo.manual.operations;

import java.io.IOException;
import java.sql.Connection;
import java.util.HashMap;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import zozopo.database.BusiDatabaseManager;
import zozopo.database.SqlMachine;
import zozopo.operations.comm.OperatingService;

public class TempOS extends OperatingService{
private static final Log logger = LogFactory.getLog(LogFactory.class);
	
	public TempOS(Connection conn){
		super(conn);
		
	}
	
	public TempOS(){
		this.databaseConnection = new BusiDatabaseManager();
		this.conn = databaseConnection.getConnection();
	}
	/**
	 * @version 1.0
	 * @param TempTB temp
	 * @author Shea
	 * @return boolean  
	 * @throws IOException 
	 * @see insertTemp(ImageTB image)
	 */
	public boolean insertTemp(TempTB temp){
		SqlMachine sqlMachine = new SqlMachine(conn);
		HashMap<String, Object> insertMap = new HashMap<String, Object>();
		
		insertMap.put(TempTB.TEMP_KEY,temp.getTemp_key());
		insertMap.put(TempTB.TEMP_CODE, temp.getTemp_code());
		insertMap.put(TempTB.TEMP_VALUE, temp.getTemp_value());
		insertMap.put(TempTB.TEMP_KIND, temp.getTemp_kind());
		
		return sqlMachine.insertRow(TempTB.TABLE_NAME, insertMap);
	}
	
}
